package stegnos.tests;

import org.quark.stegnos.Analysis;
import org.quark.stegnos.Steganos;

import processing.core.PApplet;
import processing.core.PImage;

public class StegTest02 extends PApplet {

	final String filepath = "steg/";

	PImage carrier, burden, stegan, extract;
	Steganos steg;
	String s0 = "mary had a little lamb its fleece as white a snow";
	String s1 = "mary had a little lamb its fleece as white a snow";

	public void setup(){
		size(600,400);
		background(220,220,250);
		fill(0);

		int test = 100;
		
		switch(test){
		case 0:
			analyseIB("crr_rgb.gif", "bdn_rgb_m.gif" );
			break;
		case 1:
			analyseIB("crr_rgb.gif", "bdn_argb_m.gif" );
			break;
		case 2:
			analyseIB("crr_argb.gif", "bdn_rgb_m.gif" );
			break;
		case 3:
			analyseIB("crr_argb.gif", "bdn_argb_m.gif" );
			break;
		case 4:
			analyseIB("crr_rgb.gif", "bdn_rgb_l.gif" );
			break;
		case 5:
			analyseIB("crr_rgb.gif", "bdn_argb_l.gif" );
			break;
		case 6:
			analyseIB("crr_argb.gif", "bdn_rgb_l.gif" );
			break;
		case 7:
			analyseIB( "crr_argb.gif", "bdn_argb_l.gif" );
			break;

		case 100:
			analyseTB("crr_rgb.gif", "ampoem.txt" );
			break;
		case 101:
			analyseTB("crr_argb.gif", "ampoem.txt" );
			break;
	
		case 200:
			analyseIB("bdn_rgb_m.gif", "crr_rgb.gif" );
			break;
		}
		
	}

	public void analyseIB(String env, String ins){
		carrier = loadImage(filepath + env);
		burden = loadImage(filepath + ins);
		// Analysis result
		Analysis a = Steganos.analyze(carrier, burden);
		text(a.text, 10,10,600,240);
	}

	public void analyseTB(String env, String ins){
		carrier = loadImage(filepath + env);
		// Load burden
		String[] lines = loadStrings(filepath + ins);
		String burden = join(lines, "\n");
		// Analysis result
		Analysis a = Steganos.analyze(carrier, burden);
		text(a.text, 10,10,600,400);
	}

}
